home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Widget Wizard.dir / WidgtBehaviors_79_UI Cursor Change Mouse Down Rollover.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  3.7 KB  |  95 lines

  1. property outcurs, incurs, incursSet, customImage, customMask, customDownImage, customDownMask, incursDownSet, oldcursor
  2.  
  3. on translate_cursor me, setting
  4.   case setting of
  5.     #none:
  6.       set val to 0
  7.     #arrow:
  8.       set val to -1
  9.     #IBeam:
  10.       set val to 1
  11.     #crosshair:
  12.       set val to 2
  13.     #crossbar:
  14.       set val to 3
  15.     #watch:
  16.       set val to 4
  17.     #invisible:
  18.       set val to 200
  19.     #Custom:
  20.       set val to [member the customImage of me, member the customMask of me]
  21.   end case
  22.   return val
  23. end
  24.  
  25. on translate_down_cursor me, setting
  26.   case setting of
  27.     #none:
  28.       set val to 0
  29.     #arrow:
  30.       set val to -1
  31.     #IBeam:
  32.       set val to 1
  33.     #crosshair:
  34.       set val to 2
  35.     #crossbar:
  36.       set val to 3
  37.     #watch:
  38.       set val to 4
  39.     #invisible:
  40.       set val to 200
  41.     #Custom:
  42.       set val to [member the customDownImage of me, member the customDownMask of me]
  43.   end case
  44.   return val
  45. end
  46.  
  47. on beginSprite me
  48.   set oldcursor to the cursor of sprite the spriteNum of me
  49.   set val to translate_cursor(me, the incursSet of me)
  50.   set the cursor of sprite the spriteNum of me to val
  51. end
  52.  
  53. on endSprite me
  54.   set the cursor of sprite the spriteNum of me to oldcursor
  55. end
  56.  
  57. on mouseDown me
  58.   set val to translate_down_cursor(me, the incursDownSet of me)
  59.   set the cursor of sprite the spriteNum of me to val
  60. end
  61.  
  62. on mouseUp me
  63.   set val to translate_cursor(me, the incursSet of me)
  64.   set the cursor of sprite the spriteNum of me to val
  65. end
  66.  
  67. on getPropertyDescriptionList
  68.   set description to [:]
  69.   if the currentSpriteNum = 0 then
  70.     set CursDefault to 0
  71.     set CursMaskDefault to 0
  72.   else
  73.     set memref to the member of sprite the currentSpriteNum
  74.     set castLibNum to the castLibNum of memref
  75.     set CursDefault to member (the memberNum of member memref + 1) of castLib castLibNum
  76.     set CursMaskDefault to member (the memberNum of member memref + 2) of castLib castLibNum
  77.   end if
  78.   addProp(description, #incursSet, [#comment: "Pointer Image:", #format: #symbol, #range: [#none, #arrow, #IBeam, #crosshair, #crossbar, #watch, #invisible, #Custom], #default: #Custom])
  79.   addProp(description, #customImage, [#comment: "Custom Image:", #format: #bitmap, #default: "Cursor.OpenHand"])
  80.   addProp(description, #customMask, [#comment: "Custom Mask:", #format: #bitmap, #default: "Cursor.OpenHand.Mask"])
  81.   addProp(description, #incursDownSet, [#comment: "Pointer Image:", #format: #symbol, #range: [#none, #arrow, #IBeam, #crosshair, #crossbar, #watch, #invisible, #Custom], #default: #Custom])
  82.   addProp(description, #customDownImage, [#comment: "Custom Image:", #format: #bitmap, #default: "Cursor.ClosedHand"])
  83.   addProp(description, #customDownMask, [#comment: "Custom Mask:", #format: #bitmap, #default: "Cursor.ClosedHand.Mask"])
  84.   return description
  85. end
  86.  
  87. on getBehaviorDescription
  88.   return "Display a designated Pointer Image when over the sprite.  " & RETURN & "PARAMETERS:" & RETURN & "ΓÇó Pointer Image - built in pointer to be displayed." & RETURN & "ΓÇó Custom Image  - ( optional ) number of castmember used as cursor image.  Ignored when Pointer Image is not set to Custom." & RETURN & "ΓÇó Custom Mask - ( optional ) number of castmember used as mask image.  Ignored when Pointer Image is not set to Custom." & RETURN & "ΓÇó Pointer Down Image - built in pointer to be displayed when mouse is down." & RETURN & "ΓÇó Custom Down Image  - ( optional ) number of castmember used as cursor image when mouse is down.  Ignored when Pointer Image is not set to Custom." & RETURN & "ΓÇó Custom Down Mask - ( optional ) number of castmember used as mask image when mouse is down.  Ignored when Pointer Image is not set to Custom."
  89. end
  90.  
  91. on getAssocMembers
  92.   set myPropList to [customImage, customMask, customDownImage, customDownMask]
  93.   return myPropList
  94. end
  95.